home *** CD-ROM | disk | FTP | other *** search
- Path: kuhub.cc.ukans.edu!anh
- From: anh@kuhub.cc.ukans.edu
- Newsgroups: comp.lang.c
- Subject: ugly constants and header files
- Message-ID: <1996Jan3.155754.111142@kuhub.cc.ukans.edu>
- Date: 3 Jan 96 15:57:54 CST
- Organization: University of Kansas Academic Computing Services
-
- Hello,
-
- I have a list of constants, some defined using #define, some are string
- constants a la char *gSuperStrings[]={"aa","bb"};
-
- These constants are used by multiple modules which are linked together to
- a program. However, I have more than one program using these constants,
- hence I put the constants in a header file. I know it is ugly to put
- definitions in a header file.
-
- My current solution is to change all the #define to integer constants and
- to keep 2 files:
-
- my_const.h --- To be included only once (perferably by the main()
- module). Definitions
-
- my_ext.h --- To be included by any modules using the constants.
- Declarations.
-
- Is this the best solution? Are there any other way?
-
- Thank-you,
- Anh
-